package com.apptest.android.core.network;

import com.apptest.android.core.bean.ArchitectureBean;
import com.apptest.android.core.bean.ArticleItemBean;
import com.apptest.android.core.bean.ArticleListBean;
import com.apptest.android.core.bean.BannerBean;
import com.apptest.android.core.bean.NavigationTagBean;
import com.apptest.android.core.bean.UserBean;
import com.apptest.android.core.bean.WxBloggerBean;

import java.util.List;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

public interface ApiService {
    //文章列表，按页显示
    @GET("article/list/{pageNum}/json")
    Observable<BaseResponse<ArticleListBean>> getArticleListData(@Path("pageNum") int pageNum);
    //首页Banner
    @GET("banner/json")
    Observable<BaseResponse<List<BannerBean>>> getBannerData();
    //置顶文章列表
    @GET("article/top/json")
    Observable<BaseResponse<List<ArticleItemBean>>> getTopArticles();
    //登录
    @POST("user/login")
    @FormUrlEncoded
    Observable<BaseResponse<UserBean>> login(
            @Field("username") String username, @Field("password") String password
    );
    //导航列表
    @GET("navi/json")
    Observable<BaseResponse<List<NavigationTagBean>>> getNavigationData();
    //知识体系
    @GET("/tree/json")
    Observable<BaseResponse<List<ArchitectureBean>>> getArchitectureTreeData();
    //知识体系下的文章
    @GET("article/list/{page}/json")
    Observable<BaseResponse<ArticleListBean>> getArchitectureArticles(
            @Path("page") int page, @Query("cid") int cid
    );
    //公众号
    @GET("wxarticle/chapters/json")
    Observable<BaseResponse<List<WxBloggerBean>>> getWxBloggerList();
    //公众号文章
    @GET("wxarticle/list/{id}/{page}/json")
    Observable<BaseResponse<ArticleListBean>> getWxArticles(@Path("id") int id, @Path("page") int page);
}
